home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 054a / captask.zip / CAPTASK.WBT < prev   
Text File  |  1993-02-27  |  5KB  |  187 lines

  1. ;                            >>>>> CapTask <<<<<
  2. ;                              Bo Peng 2/15/93
  3.  
  4. ;WinHide("Batch Runner")
  5. ;if StrIndex(IniReadPvt("boot","shell","progman","c:\win\system.ini"),"ndw",1,@FWDSCAN) != 0 then goto OK
  6. ;if StrIndex(IniReadPvt("boot","shell","progman","c:\win\system.ini"),"NDW",1,@FWDSCAN) != 0 then goto OK
  7. ;goto WrongShell
  8. :OK
  9. Exclusive(@OFF)
  10. ErrorMode(@OFF)
  11. IntControl(12, 1, 0, 0, 0)
  12. n=0
  13. ;    The product of "I" and the delay value (see later) tells CapTask how many
  14. ;    seconds to wait before updating the time/res info on the caption bar.
  15. ;    Decrease it if you have more CPU time to waste. In fact, I suspect
  16. ;   the impact should be very minimal.
  17. I=10
  18. Tab=Num2Char(9)
  19. Enter=Num2Char(13)
  20. ;    Change the string between brackets if you don't like the name. But after
  21. ;    you've changed names for this file AND captask.wbd
  22. CapTask="CapTask"
  23. ;    Replace DirHome() with the direcory name in double quotes if you decide
  24. ;    not to put captask.wbt and captask.wbd in your NDW directory. Or simply
  25. ;    give the actual full path name for captask.wbd.
  26. WBD=StrCat(DirHome(),CapTask,".wbd")
  27. Bare=WinGetActive()
  28. Temp=Bare
  29.  
  30. :Title
  31. dt1=DateTime()
  32. dt=StrSub(dt1,1,StrLen(dt1)-6)
  33. if StrIndex(dt1,"AM",1,@FWDSCAN) != 0 then goto AM
  34. if StrIndex(dt1,"PM",1,@FWDSCAN) != 0 then dt=StrCat("[",dt,"pm  ")
  35. goto Res
  36. :AM
  37. dt=StrCat("[",dt,"am  ")
  38. :Res
  39. m=WinResources(0)/1024
  40. Full=StrCat(dt,StrCat(Min(WinResources(2),WinResources(3),WinResources(4)),"%% %m%K] - "),Bare)
  41. WinTitle(Temp,Full)
  42.  
  43. :Wait
  44. ;    The delay value tells CapTask how many seconds to wait before checking
  45. ;    for mouse buttons. MUST be integer (bummer...).
  46. Delay(1)
  47. n=n+1
  48. ;    MouseInfo(4)=1 means the RIGHT button is down. Change this if you want
  49. ;    to use other buttons or combinations to activate the CapTaskMan.
  50. if MouseInfo(4) == 1 then goto ChkM
  51. if n != I then goto Wait
  52.  
  53. :ChkT
  54. n=0
  55. Temp=WinGetActive()
  56. if WinState(Temp) == -1 then goto Wait
  57. if StrIndex(Temp,Bare,1,@FWDSCAN) != 0 then goto Title
  58. if WinExist(Full) then WinTitle(Full,Bare)
  59. Bare=Temp
  60. goto Title
  61.  
  62. :ChkM
  63. if MouseInfo(1) == "" then goto TMan
  64. if n != I then goto Wait
  65. goto ChkT
  66.  
  67. :TMan
  68. Sounds(0)
  69. DialogBox(StrCat(CapTask," Task/Desktop Manager"),WBD)
  70. if task == 1 then goto ChkD
  71. if task <  5 then goto List
  72. if task == 5 then goto Exit
  73. if task == 6 then goto ExitWin
  74. if task == 7 then goto Restart
  75. :Reboot
  76. Sounds(1)
  77. if AskYesNo("REBOOT","Are you sure about rebooting the machine?") == @NO then goto ChkD
  78. IntControl(67,0,0,0,0)
  79. :ExitWin
  80. Sounds(1)
  81. if AskYesNo("EXIT WINDOWS","Are you sure about exiting Windows?") == @NO then goto ChkD
  82. EndSession()
  83. :Restart
  84. Sounds(1)
  85. if AskYesNo("RESTART WINDOWS","Are you sure about restarting Windows?") == @NO then goto ChkD
  86. IntControl(66,0,0,0,0)
  87.  
  88. :List
  89. Exclusive(@ON)
  90. Display(1,"Compiling Task List","Just a coupl'o seconds...")
  91. l=1
  92. tList=""
  93. WList=WinItemize()
  94. j=ItemCount(WList,Tab)
  95.  
  96. :GetT
  97. tLen=StrIndex(WList,Tab,l,@FWDSCAN)
  98. t=StrSub(WList,l,tLen-l)
  99. l=tLen+1
  100. if StrIndex(t,"Delay Error",1,@FWDSCAN) != 0 then goto Skip
  101. if WinState(t) == -1 then goto Hidden
  102. t=StrCat("[s]--",t)
  103. goto BuildList
  104. :Hidden
  105. t=StrCat("[h]--",t)
  106. :BuildList
  107. tList=StrCat(tList,t,Tab)
  108. :Skip
  109. j=j-1
  110. if j != 0 then goto GetT
  111. if task == 2 then goto SH
  112. if task == 3 then goto CT
  113.  
  114. :Kill
  115. t=ItemSelect("Select Task to Kill",tList,Tab)
  116. if t == "" then goto ChkD
  117. t=StrSub(t,6,StrLen(t)-5)
  118. Sounds(1)
  119. if AskYesNo("KILL TASK",StrCat("Are you sure you want to kill",Enter,"<< ",t," >>???")) == @YES then goto DoIt
  120. ;    Change the message if you dislke the idea of a computer delivering a
  121. ;    message from your God.
  122. Display(2,"FATHER","Wise choice, mortal!")
  123. goto ChkD
  124. :DoIt
  125. ;    Change the message if it makes you feel uneasy/nervous/outright scared.
  126. Display(2,"COP","You're under arrest for attempted murder...")
  127. WinClose(t)
  128. goto ChkD
  129.  
  130. :CT
  131. t=ItemSelect("Select Window to Change Title",tList,Tab)
  132. if t == "" then goto ChkD
  133. t=StrSub(t,6,StrLen(t)-5)
  134. NewT=AskLine("Change Title",StrCat("New Title for",Enter,"<< ",t," >>"),"")
  135. if NewT == "" then goto ChkD
  136. WinTitle(t,NewT)
  137. goto ChkD
  138.  
  139. :SH
  140. t=ItemSelect("Select Task to Show/Hide",tList,Tab)
  141. if t == "" then goto ChkD
  142. State=StrSub(t,2,1)
  143. t=StrSub(t,6,StrLen(t)-5)
  144. if State == "h" then goto ShowH
  145. WinHide(t)
  146. goto ChkD
  147. :ShowH
  148. WinShow(t)
  149.  
  150. :ChkD
  151. WinActivate(Full)
  152. Sounds(1)
  153. if desk == 1 then goto End
  154. if desk == 2 then goto Stackem
  155. if desk == 3 then goto Tilem
  156. if desk == 4 then goto Rowem
  157. if desk == 5 then goto Columnem
  158. :Arrangem
  159. IconArrange()
  160. goto End
  161. :Stackem
  162. WinArrange(@STACK)
  163. goto End
  164. :Tilem
  165. WinArrange(@TILE)
  166. goto End
  167. :Rowem
  168. WinArrange(@ROWS)
  169. goto End
  170. :Columnem
  171. WinArrange(@COLUMNS)
  172.  
  173. :End
  174. Exclusive(@OFF)
  175. if n != I then goto Wait
  176. goto ChkT
  177.  
  178. :Exit
  179. Sounds(1)
  180. if AskYesNo(StrCat("EXIT ",CapTask),StrCat("Are you sure about terminating ",CapTask,"?")) != @YES then goto ChkD
  181. if WinExist(Full) then WinTitle(Full,Bare)
  182. exit
  183.  
  184. :WrongShell
  185. Display(2,"WRONG SHELL",StrCat(CapTask," will only run if the Norton Desktop is your shell."))
  186. exit
  187.